﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GameVLTK
{
    public class HealthBar 
    {
        private int _NumberOfHealthDots;

        public int NumberOfHealthDots
        {
            get { return _NumberOfHealthDots; }
            set { _NumberOfHealthDots = value; }
        }
        private Texture2D _HealthBarTexture;

        public Texture2D HealthBarTexture
        {
            get { return _HealthBarTexture; }
            set { _HealthBarTexture = value; }
        }
        private Texture2D _HealthDotTexture;

        public Texture2D HealthDotTexture
        {
            get { return _HealthDotTexture; }
            set { _HealthDotTexture = value; }
        }
        private Vector2 _HealthBarPosition;

        public Vector2 HealthBarPosition
        {
            get { return _HealthBarPosition; }
            set { _HealthBarPosition = value; }
        }
        private Vector2 _HealthDotPosition;

        public Vector2 HealthDotPosition
        {
            get { return _HealthDotPosition; }
            set { _HealthDotPosition = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public HealthBar(ContentManager Content,string healthBarTexturePath, 
                         string healthDotTexturePath, Vector2 healthBarPosition)
        {
            this.HealthBarTexture = Content.Load<Texture2D>(healthBarTexturePath);
            this.HealthDotTexture = Content.Load<Texture2D>(healthDotTexturePath);
            this.HealthBarPosition = healthBarPosition;
        }

        /// <summary>
        /// 
        /// </summary>
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(this.HealthBarTexture, this.HealthBarPosition, Color.White);

            for (int i = 0; i < NumberOfHealthDots; i++)
            {
                Vector2 dotPosition = new Vector2(HealthDotPosition.X + i * 2,
                                  HealthDotPosition.Y);

                spriteBatch.Draw(this.HealthDotTexture, dotPosition, Color.White);
            }
        }

       
    }
}
